<template>
  <div class="">
    <p @click="aaaa">公众号绑定</p>
  </div>
</template>

<script>
import {currentBind} from '@/api/Officialbinding'
export default {
  components: {},
  props: {},
  data() {
    return {}
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  destroyed() {},
  methods: {
    //获取url参数
    getUrlKey(name) {
      return (
        decodeURIComponent(
          (new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ''])[1].replace(
            /\+/g,
            '%20'
          )
        ) || null
      )
    },
    aaaa() {
      // let urlNow = encodeURIComponent(window.location.href)
      // // let scope='snsapi_userinfo';    //snsapi_userinfo 非静默授权用户有感知 snsapi_base 静默授权用户无感知
      // let url = 'https://open.weixin.qq.com' + '/connect/oauth2/authorize?appid='wx25534c316fb0884a'&redirect_uri=' + urlNow + '&response_type=code&scope=snsapi_userinfo#wechat_redirect'
      // window.location.href = url
      let code='wx25534c316fb0884a'
      currentBind({code}).then(res=>{
        console.log(res);
      })
    },
  },
}
</script>
<style scoped lang='less'>
</style>
